package io.github.eiot.json.deserializer;

import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import io.github.eiot.codec.Ascii;

import java.io.IOException;

/**
 * created by wang007 on 2025/9/27
 */
public class AsciiDeserializer extends JsonDeserializer<Ascii> {

    public static final AsciiDeserializer INSTANCE = new AsciiDeserializer();

    @Override
    public Ascii deserialize(JsonParser p, DeserializationContext ctx) throws IOException, JacksonException {
        String text = p.getText();
        return Ascii.from(text);
    }
}
